<template>
  <div class="hello">
    <h2>文件上传</h2>
    <div>
      <input type="file" @change="getFile($event)" name="file" multiple="multiple"/>
    </div>
  </div>
</template>

<script>
import {postRequestForUpload} from "@/axio2";

export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  methods:{
    getFile(e){
      let formData = new FormData();
      let fileList = e.target.files;
      for(let j=0;fileList.length>j;j++){
        formData.append('file',fileList[j]);
      }
      postRequestForUpload(
          'operFile/upload.do',
          formData,
          null,
          null,
          this
      );
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
